package com.cloudfun.campusshare.common.model.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.date.DateUtil;
import com.cloudfun.campusshare.service.impl.ReplenishServiceImpl;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * @author wangxiyuan
 * @description
 * @createDate 2021/5/20 13:46
 **/
@Data
@ApiModel(value = "补货日志列表")
public class ReplenishLogDTO implements Serializable {
    public static final int WIDTH = 17;

    @ApiModelProperty(value = "设备名称")
    @Excel(name = "设备名称", width = WIDTH)
    private String deviceName;

    @ApiModelProperty(value = "设备类型")
    @Excel(name = "设备类型", width = WIDTH)
    private String deviceType;

    @ApiModelProperty(value = "归属运营商")
    @Excel(name = "归属运营商", width = WIDTH)
    private String belongMerchantName;

    @ApiModelProperty(value = "场地名称")
    @Excel(name = "场地名称", width = WIDTH)
    private String name;

    @ApiModelProperty(value = "补货时间")
    @Getter(value = AccessLevel.NONE)
    @Excel(name = "补货时间", width = WIDTH)
    private String createTime;

    @ApiModelProperty(value = "补货员")
    @Excel(name = "补货员", width = WIDTH)
    private String  creatorName;

    @ApiModelProperty(value = "补货类型,1是洗衣液；2是消毒液")
    @Excel(name = "补货类型", width = WIDTH)
    private String liquidType;

    @ApiModelProperty(value = "补货前库存")
    @Excel(name = "补货前库存(单位g)", width = WIDTH)
    private Integer lastCapacity;

    @ApiModelProperty(value = "补货后库存")
    @Excel(name = "补货后库存(单位g)", width = WIDTH)
    private Integer currentCapacity;

    public String getCreateTime(){
        if(StringUtils.isNotBlank(createTime)){
            return DateUtil.formatDateTime(new Date(Long.parseLong(createTime)));
        }
        return createTime;
    }
}
